<?php
/**
 * Nguoi tao: 
 * Ngay tao: 
 * Y nghia: 
 */	
class mtl_printController extends  Zend_Controller_Action {
	public function init(){
		Zend_Loader::loadClass('mtl_modPrint');
		Zend_Loader::loadClass('Zend_Json');	    
		//Load cau hinh thu muc trong file config.ini
        $tempDirApp = Zend_Registry::get('conDirApp');
		$this->_dirApp = $tempDirApp->toArray();
		$this->view->dirApp = $tempDirApp->toArray();
		//Lay duong dan thu muc goc (path directory root)
		$this->view->baseUrl = $this->_request->getBaseUrl() . "/public/";
		if (!$this->_request->isXmlHttpRequest()){
			//Cau hinh cho Zend_layout
			Zend_Layout::startMvc(array(
				    'layoutPath' => $this->_dirApp['layout'],
				    'layout' => 'index'			    
				    ));	
			//Load cac thanh phan cau vao trang layout (index.phtml)
			$response = $this->getResponse();
			//Ky tu dac biet phan tach giua cac phan tu
			$this->view->delimitor 	= "!~~!";	
			//Load cau hinh thu muc trong file config.ini de lay ca hang so dung chung
	        $tempConstPublic = Zend_Registry::get('ConstPublic');
			$this->_ConstPublic = $tempConstPublic->toArray();	
			//Lay cac hang so su dung trong JS public
			$objConfig = new Efy_Init_Config();
			$objConst = new Efy_Init_Const();
			$this->view->JSPublicConst = $objConfig->_setJavaScriptPublicVariable();		
			$this->view->UrlAjax = $objConfig->_setUrlAjax();
			$arrConst = $objConst->_setProjectPublicConst();
			$this->view->arrConst = $arrConst;
			// Load tat ca cac file Js va Css
			$this->view->LoadAllFileJsCss = Efy_Publib_Library::_getAllFileJavaScriptCss(''
				,'efy-js'
				,'mtl/training.js,print.js,ajaxupload.3.5.js,fg.menu.js,jquery.maskedinput-1.3.js,'
				,','
				,'js')
			.Efy_Publib_Library::_getAllFileJavaScriptCss('','efy-style','print.css,simpleModal.css,fg.menu.css',',','css')
			.Efy_Publib_Library::_getAllFileJavaScriptCss('','efy-style','chosen/chosen.css',',','css')
			.Efy_Publib_Library::_getAllFileJavaScriptCss('','efy-js','chosen/chosen.jquery.js',',','js');		
			//Dinh nghia current modul code
			$this->view->currentModulCode = "PRINT";
			$this->view->currentModulCodeForLeft = "index";	
			//Hien thi file template
	        $response->insert('header', $this->view->renderLayout('header.phtml','./application/views/scripts/'));    	//Hien thi header 
			$response->insert('menu', $this->view->renderLayout('menu.phtml','./application/views/scripts/'));    		//Hien thi header 		
	        $response->insert('footer', $this->view->renderLayout('footer.phtml','./application/views/scripts/')); 			
		}else{
			$result = array();
			$result = Efy_Publib_Library::_getAllFileJavaScriptCssArray('','efy-js','mtl/training.js,ajaxupload.3.5.js,fg.menu.js,',',','js',$result);
			$result = Efy_Publib_Library::_getAllFileJavaScriptCssArray('','efy-style','fg.menu.css',',','css',$result);
			$result = Efy_Publib_Library::_getAllFileJavaScriptCssArray('','efy-style','chosen/chosen.css',',','css',$result);
			$result = Efy_Publib_Library::_getAllFileJavaScriptCssArray('','efy-js','chosen/chosen.jquery.js',',','js',$result);			
			$this->view->arrJsCss = Zend_Json::encode($result);	
			$baseurl=$this->_request->getbaseurl();			 
		}
	}	
	/**
	 * @author:Truongdv
	 * @see: 16/08/2012
	 * @todo: Phương thức hiển thị dữ liệu cho toàn bộ các Action
	 * Enter description here ...
	 */
	public function indexAction(){
		$arrWards = array();		
		$objFunction = New Efy_Function_RecordFunctions();		
		$this->view->titleBody = "DANH SÁCH BÀI GIẢNG";					
		$this->view->arrListItem = $objFunction->getAllObjectbyListCode('','DM_SO_HS_TREN_TRANG');
		$this->view->iCurrentPage = 1;
		$this->view->iNumberRecordPerPage = 15;
	}			
}
?>
